<!DOCTYPE HTML>
<html lang="zh-CN">


<head>
    <meta charset="utf-8">
    <meta name="keywords" content="Linux 学习记录">
    <meta name="description" content="hello,here is lstink&#39;s blog.">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <!-- Global site tag (gtag.js) - Google Analytics -->

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-166915022-1"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag() {
        dataLayer.push(arguments);
    }

    gtag('js', new Date());
    gtag('config', 'UA-166915022-1');
</script>


    <title>Linux-学习记录 | Lstink</title>
    <link rel="icon" type="image/png" href="/favicon.png">

    <link rel="stylesheet" type="text/css" href="/libs/awesome/css/all.css">
    <link rel="stylesheet" type="text/css" href="/libs/materialize/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="/css/matery.css">
    <link rel="stylesheet" type="text/css" href="/css/my.css">

    <script src="/libs/jquery/jquery.min.js"></script>

<meta name="generator" content="Hexo 4.2.0"><link rel="alternate" href="/atom.xml" title="Lstink" type="application/atom+xml">
<link rel="stylesheet" href="/css/prism-tomorrow.css" type="text/css"></head>


<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper container">
            <div class="brand-logo">
                <a href="/" class="waves-effect waves-light">
                    
                    <img src="/medias/logo.png" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">Lstink</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>首页</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/tags" class="waves-effect waves-light">
      
      <i class="fas fa-tags" style="zoom: 0.6;"></i>
      
      <span>标签</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/categories" class="waves-effect waves-light">
      
      <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
      
      <span>分类</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/archives" class="waves-effect waves-light">
      
      <i class="fas fa-archive" style="zoom: 0.6;"></i>
      
      <span>归档</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/about" class="waves-effect waves-light">
      
      <i class="fas fa-user-circle" style="zoom: 0.6;"></i>
      
      <span>关于</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/contact" class="waves-effect waves-light">
      
      <i class="fas fa-comments" style="zoom: 0.6;"></i>
      
      <span>留言板</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/friends" class="waves-effect waves-light">
      
      <i class="fas fa-address-book" style="zoom: 0.6;"></i>
      
      <span>友情链接</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>


<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="/medias/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">Lstink</div>
        <div class="logo-desc">
            
            hello,here is lstink&#39;s blog.
            
        </div>
    </div>

    

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/tags" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-tags"></i>
			
			标签
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/categories" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-bookmark"></i>
			
			分类
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/archives" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-archive"></i>
			
			归档
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/about" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-user-circle"></i>
			
			关于
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/contact" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-comments"></i>
			
			留言板
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/friends" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-address-book"></i>
			
			友情链接
		</a>
          
        </li>
        
        
    </ul>
</div>


        </div>

        
    </nav>

</header>

    



<div class="bg-cover pd-header post-cover" style="background-image: url('/medias/featureimages/0.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">Linux-学习记录</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <link rel="stylesheet" href="/libs/tocbot/tocbot.css">
<style>
    #articleContent h1::before,
    #articleContent h2::before,
    #articleContent h3::before,
    #articleContent h4::before,
    #articleContent h5::before,
    #articleContent h6::before {
        display: block;
        content: " ";
        height: 100px;
        margin-top: -100px;
        visibility: hidden;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        width: 345px;
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        margin: 35px 0 15px 0;
        padding-left: 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content {
        height: calc(100vh - 250px);
        overflow: auto;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;

        position: absolute;
        right: 23.5vw;
        display: block;
    }

    .toc-fixed .toc-link::before{
        position: fixed!important;/*当toc的位置改为fixed时，.toc-link::before也要改为fixed*/
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #toc-content .is-active-link::before {
        background-color: #42b983;
    }

    #floating-toc-btn {
        position: fixed;
        right: 15px;
        bottom: 76px;
        padding-top: 15px;
        margin-bottom: 0;
        z-index: 998;
    }

    #floating-toc-btn .btn-floating {
        width: 48px;
        height: 48px;
    }

    #floating-toc-btn .btn-floating i {
        line-height: 48px;
        font-size: 1.4rem;
    }
</style>
<div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/tags/linux/">
                                <span class="chip bg-color">linux</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                    <div class="post-cate">
                        <i class="fas fa-bookmark fa-fw icon-category"></i>
                        
                            <a href="/categories/linux/" class="post-category">
                                linux
                            </a>
                        
                    </div>
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2020-07-18
                </div>
                

                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-check fa-fw"></i>更新日期:&nbsp;&nbsp;
                    2020-07-28
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-file-word fa-fw"></i>文章字数:&nbsp;&nbsp;
                    3.4k
                </div>
                

                

                
                    <div id="busuanzi_container_page_pv" class="info-break-policy">
                        <i class="far fa-eye fa-fw"></i>阅读次数:&nbsp;&nbsp;
                        <span id="busuanzi_value_page_pv"></span>
                    </div>
				
            </div>
        </div>
        <hr class="clearfix">
        <div class="card-content article-card-content">
            <div id="articleContent">
                <h1 id="Liunx-（centos8）-学习记录"><a href="#Liunx-（centos8）-学习记录" class="headerlink" title="Liunx （centos8） 学习记录"></a>Liunx （centos8） 学习记录</h1><h2 id="rpm（红帽软件包管理器）"><a href="#rpm（红帽软件包管理器）" class="headerlink" title="rpm（红帽软件包管理器）"></a>rpm（红帽软件包管理器）</h2><table>
<thead>
<tr>
<th>描述</th>
<th>命令</th>
</tr>
</thead>
<tbody><tr>
<td>安装软件的命令格式</td>
<td>rpm -ivh filename.rpm</td>
</tr>
<tr>
<td>升级软件的命令格式</td>
<td>rpm -Uvh filename.rpm</td>
</tr>
<tr>
<td>卸载软件的命令格式</td>
<td>rpm -e filename.rpm</td>
</tr>
<tr>
<td>查询软件描述信息的命令格式</td>
<td>rpm -qpi filename.rpm</td>
</tr>
<tr>
<td>列出软件文件信息的命令格式</td>
<td>rpm -qpl filename.rpm</td>
</tr>
<tr>
<td>查询文件属于哪个 RPM 的命令格式</td>
<td>rpm -qf filename</td>
</tr>
</tbody></table>
<h2 id="yum软件仓库"><a href="#yum软件仓库" class="headerlink" title="yum软件仓库"></a>yum软件仓库</h2><table>
<thead>
<tr>
<th>命令</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td>yum repolist all</td>
<td>列出所有仓库</td>
</tr>
<tr>
<td>yum list all</td>
<td>列出仓库中所有软件包</td>
</tr>
<tr>
<td>yum info 软件包名称</td>
<td>查看软件包信息</td>
</tr>
<tr>
<td>yum install 软件包名称</td>
<td>安装软件包</td>
</tr>
<tr>
<td>yum reinstall 软件包名称</td>
<td>重新安装软件包</td>
</tr>
<tr>
<td>yum update 软件包名称</td>
<td>升级软件包</td>
</tr>
<tr>
<td>yum rempve 软件包名称</td>
<td>删除软件包</td>
</tr>
<tr>
<td>yum clean all</td>
<td>清除所有仓库缓存</td>
</tr>
<tr>
<td>yum check-update</td>
<td>检查可更新的软件包</td>
</tr>
<tr>
<td>yum grouplist</td>
<td>查看系统中已经安装的软件包组</td>
</tr>
<tr>
<td>yum groupinstall 软件包组</td>
<td>安装指定的软件包组</td>
</tr>
<tr>
<td>yum groupremove 软件包组</td>
<td>删除指定的软件包组</td>
</tr>
<tr>
<td>Yum groupinfo 软件包组</td>
<td>查看指定的软件包组信息</td>
</tr>
</tbody></table>
<blockquote>
<p>RPM 是为了简化安装的复杂度，而 Yum 软件仓库是为了解决软件包之间的依赖关系</p>
<p>RHEL 7 系统采用了 systemd 作为初始化进程，那么如何查看某个服务的运行状态？</p>
<p>答：执行命令“systemctl status 服务名.service”可查看服务的运行状态，其中服务名后</p>
<p>的.service 可以省略。</p>
</blockquote>
<h2 id="systemctl-与-service"><a href="#systemctl-与-service" class="headerlink" title="systemctl 与 service"></a>systemctl 与 service</h2><img src="/2020/07/18/linux-xue-xi-ji-lu/image-20200718220114119.png" class title="对比">

<h2 id="必须掌握的命令"><a href="#必须掌握的命令" class="headerlink" title="必须掌握的命令"></a>必须掌握的命令</h2><h3 id="1-echo"><a href="#1-echo" class="headerlink" title="1.echo"></a>1.echo</h3><h3 id="2-date"><a href="#2-date" class="headerlink" title="2.date"></a>2.date</h3><ul>
<li><code>date &quot;+%Y-%m-%d %H:%M:%S&quot;</code> 设置系统时间： <code>date -s &quot;20200701 8:30:00&quot;</code> %j表示今天是当年中的第几天 <code>date &quot;+%j&quot;</code></li>
</ul>
<h3 id="3-reboot-重启"><a href="#3-reboot-重启" class="headerlink" title="3.reboot 重启"></a>3.reboot 重启</h3><h3 id="4-poweroff-关机"><a href="#4-poweroff-关机" class="headerlink" title="4.poweroff 关机"></a>4.poweroff 关机</h3><h3 id="5-wget-命令行下载"><a href="#5-wget-命令行下载" class="headerlink" title="5.wget 命令行下载"></a>5.wget 命令行下载</h3><ul>
<li>-b 后台下载模式</li>
<li>-P下载到指定目录</li>
<li>-t 最大尝试次数</li>
<li>-c 断点续传</li>
<li>-p 下载页面内所有资源，包括图片、视频等</li>
<li>-r 递归下载</li>
</ul>
<h3 id="6-ps-查看系统中的进程状态"><a href="#6-ps-查看系统中的进程状态" class="headerlink" title="6.ps 查看系统中的进程状态"></a>6.ps 查看系统中的进程状态</h3><ul>
<li><p>-a 显示所有进程</p>
</li>
<li><p>-u 用户以及其他详细信息</p>
</li>
<li><p>-x 显示没有控制终端的进程</p>
<img src="/2020/07/18/linux-xue-xi-ji-lu/image-20200718223032314.png" class title="进程状态">

<blockquote>
<p>Linux 系统中时刻运行着许多进程，如果能够合理地管理它们，则可以优化系统的性能。在</p>
<p>Linux 系统中，有 5 种常见的进程状态，分别为运行、中断、不可中断、僵死与停止，其各自</p>
<p>含义如下所示。</p>
<p>R（运行）：进程正在运行或在运行队列中等待。</p>
<p>S（中断）：进程处于休眠中，当某个条件形成后或者接收到信号时，则脱离该</p>
<p>状态。</p>
<p>D（不可中断）：进程不响应系统异步信号，即便用 kill 命令也不能将其中断。</p>
<p>Z（僵死）：进程已经终止，但进程描述符依然存在, 直到父进程调用 wait4()系统函数</p>
<p>后将进程释放。</p>
<p>T（停止）：进程收到停止信号后停止运行。</p>
<p>当执行 ps aux 命令后通常会看到如表 2-7 所示的进程状态，表 2-7 中只是列举了部分输</p>
<p>出值，而且正常的输出值中不包括中文注释。</p>
</blockquote>
</li>
</ul>
<h3 id="7-top-动态地监视进程活动与系统负载等信息"><a href="#7-top-动态地监视进程活动与系统负载等信息" class="headerlink" title="7.top 动态地监视进程活动与系统负载等信息"></a>7.top 动态地监视进程活动与系统负载等信息</h3><blockquote>
<p>top 命令执行结果的前 5 行为系统整体的统计信息，其所代表的含义如下。</p>
<p>第 1 行：系统时间、运行时间、登录终端数、系统负载（三个数值分别为 1 分钟、5</p>
<p>分钟、15 分钟内的平均值，数值越小意味着负载越低）。 </p>
<p>第 2 行：进程总数、运行中的进程数、睡眠中的进程数、停止的进程数、僵死的进程</p>
<p>数。</p>
<p>第 3 行：用户占用资源百分比、系统内核占用资源百分比、改变过优先级的进程资源</p>
<p>百分比、空闲的资源百分比等。</p>
<p>注：</p>
<p>第 3 行中的数据均为 CPU 数据并以百分比格式显示，例如“97.1 id”意味着有 97.1%</p>
<p>的 CPU 处理器资源处于空闲。</p>
<p>第 4 行：物理内存总量、内存使用量、内存空闲量、作为内核缓存的内存量。</p>
<p>第 5 行：虚拟内存总量、虚拟内存使用量、虚拟内存空闲量、已被提前加载的内存量。</p>
</blockquote>
<h3 id="8-pidof-查询某个指定服务进程的-PID-值"><a href="#8-pidof-查询某个指定服务进程的-PID-值" class="headerlink" title="8.pidof 查询某个指定服务进程的 PID 值"></a>8.pidof 查询某个指定服务进程的 PID 值</h3><h3 id="9-Kill-终止某个指定-PID-的服务进程"><a href="#9-Kill-终止某个指定-PID-的服务进程" class="headerlink" title="9.Kill 终止某个指定 PID 的服务进程"></a>9.Kill 终止某个指定 PID 的服务进程</h3><h3 id="10-killall-终止某个指定名称的服务所对应的全部进程"><a href="#10-killall-终止某个指定名称的服务所对应的全部进程" class="headerlink" title="10.killall 终止某个指定名称的服务所对应的全部进程"></a>10.killall 终止某个指定名称的服务所对应的全部进程</h3><h3 id="11-ifconfig"><a href="#11-ifconfig" class="headerlink" title="11.ifconfig"></a>11.ifconfig</h3><h3 id="12-uname-a-于查看系统内核与系统版本等信息"><a href="#12-uname-a-于查看系统内核与系统版本等信息" class="headerlink" title="12.uname -a 于查看系统内核与系统版本等信息"></a>12.uname -a 于查看系统内核与系统版本等信息</h3><ul>
<li>查看系统版本信息 <code>cat /etc/redhat-release</code></li>
</ul>
<h3 id="13-uptime-查看系统的负载信息"><a href="#13-uptime-查看系统的负载信息" class="headerlink" title="13.uptime 查看系统的负载信息"></a>13.uptime 查看系统的负载信息</h3><blockquote>
<p>它可以显示当前系统时间、系统已运行时间、启用终端数量以</p>
<p>及平均负载值等信息。平均负载值指的是系统在最近 1 分钟、5 分钟、15 分钟内的压力情</p>
<p>况（下面加粗的信息部分）；负载值越低越好，尽量不要长期超过 1，在生产环境中不要</p>
<p>超过 5。</p>
</blockquote>
<h3 id="14-free-h-于显示当前系统中内存的使用量信息"><a href="#14-free-h-于显示当前系统中内存的使用量信息" class="headerlink" title="14.free -h 于显示当前系统中内存的使用量信息"></a>14.free -h 于显示当前系统中内存的使用量信息</h3><h3 id="15-who-查看当前登入主机的用户终端信息"><a href="#15-who-查看当前登入主机的用户终端信息" class="headerlink" title="15.who 查看当前登入主机的用户终端信息"></a>15.who 查看当前登入主机的用户终端信息</h3><h3 id="16-last-查看所有系统的登录记录"><a href="#16-last-查看所有系统的登录记录" class="headerlink" title="16.last 查看所有系统的登录记录"></a>16.last 查看所有系统的登录记录</h3><h3 id="17-history-于显示历史执行过的命令"><a href="#17-history-于显示历史执行过的命令" class="headerlink" title="17.history 于显示历史执行过的命令"></a>17.history 于显示历史执行过的命令</h3><h3 id="18-sosreport-收集系统配置及架构信息并输出诊断文档"><a href="#18-sosreport-收集系统配置及架构信息并输出诊断文档" class="headerlink" title="18.sosreport 收集系统配置及架构信息并输出诊断文档"></a>18.sosreport 收集系统配置及架构信息并输出诊断文档</h3><h3 id="19-cat-n-查看内容并打印行号"><a href="#19-cat-n-查看内容并打印行号" class="headerlink" title="19.cat -n 查看内容并打印行号"></a>19.cat -n 查看内容并打印行号</h3><h3 id="20-head-n-20-查看文档的前20行"><a href="#20-head-n-20-查看文档的前20行" class="headerlink" title="20.head -n 20 查看文档的前20行"></a>20.head -n 20 查看文档的前20行</h3><h3 id="21-tail-查看纯文本文档的后-N-行或持续刷新内容"><a href="#21-tail-查看纯文本文档的后-N-行或持续刷新内容" class="headerlink" title="21.tail 查看纯文本文档的后 N 行或持续刷新内容"></a>21.tail 查看纯文本文档的后 N 行或持续刷新内容</h3><h3 id="22-tr-替换文本文件中的字符"><a href="#22-tr-替换文本文件中的字符" class="headerlink" title="22.tr 替换文本文件中的字符"></a>22.tr 替换文本文件中的字符</h3><ul>
<li><code>cat anaconda-ks.cfg | tr [a-z] [A-Z]</code> 小写转化为大写</li>
</ul>
<h3 id="23-wc-统计指定文本的行数、字数、字节数"><a href="#23-wc-统计指定文本的行数、字数、字节数" class="headerlink" title="23.wc 统计指定文本的行数、字数、字节数"></a>23.wc 统计指定文本的行数、字数、字节数</h3><ul>
<li>-l 只显示行数</li>
<li>-w 只显示单词数</li>
<li>-c 只显示字节数</li>
</ul>
<h3 id="24-stat-查看文件的具体存储信息和时间等信息"><a href="#24-stat-查看文件的具体存储信息和时间等信息" class="headerlink" title="24.stat 查看文件的具体存储信息和时间等信息"></a>24.stat 查看文件的具体存储信息和时间等信息</h3><h3 id="25-cut-按“列”提取文本字符，格式为“cut-参数-文本”"><a href="#25-cut-按“列”提取文本字符，格式为“cut-参数-文本”" class="headerlink" title="25.cut 按“列”提取文本字符，格式为“cut [参数] 文本”"></a>25.cut 按“列”提取文本字符，格式为“cut [参数] 文本”</h3><ul>
<li><code>cut -d: -f1 /etc/passwd</code> 提取出 passwd 文件中的用户名信息，即提取以冒号（：）为间隔符号的第一列内容</li>
</ul>
<h3 id="26-diff-比较多个文本文件的差异"><a href="#26-diff-比较多个文本文件的差异" class="headerlink" title="26.diff 比较多个文本文件的差异"></a>26.diff 比较多个文本文件的差异</h3><ul>
<li>diff –brief 命令显示比较后的结果，判断文件是否相同：<code>diff --brief diff_A.txt diff_B.txt</code></li>
<li>最后使用带有-c 参数的 diff 命令来描述文件内容具体的不同：<code>diff -c diff_A.txt diff_B.txt</code></li>
</ul>
<h3 id="27-touch-创建空白文件或设置文件的时间"><a href="#27-touch-创建空白文件或设置文件的时间" class="headerlink" title="27.touch 创建空白文件或设置文件的时间"></a>27.touch 创建空白文件或设置文件的时间</h3><ul>
<li>-a 仅修改读取时间(atime)</li>
<li>-m 仅修改修改时间(mtime)</li>
<li>-d 同时修改atime 和 mtime</li>
</ul>
<h3 id="28-cp-复制文件或目录"><a href="#28-cp-复制文件或目录" class="headerlink" title="28.cp 复制文件或目录"></a>28.cp 复制文件或目录</h3><ul>
<li>-p 保留原始文件的属性</li>
<li>-d 若对象为“链接文件”，则保留该“链接文件”的属性</li>
<li>-r 递归持续复制（用于目录）</li>
<li>-i 若目标文件存在则询问是否覆盖</li>
<li>-a 相当于-pdr（p、d、r 为上述参数）</li>
</ul>
<h3 id="29-dd-按照指定大小和个数的数据块来复制文件的内容"><a href="#29-dd-按照指定大小和个数的数据块来复制文件的内容" class="headerlink" title="29.dd 按照指定大小和个数的数据块来复制文件的内容"></a>29.dd 按照指定大小和个数的数据块来复制文件的内容</h3><ul>
<li>If 输入的文件名称</li>
<li>of 输出的文件名称</li>
<li>bs 设置每个“块”的大小</li>
<li>count 设置要复制“块”的个数</li>
<li><code>dd if=/dev/zero of=560_file count=1 bs=560M</code> 从/dev/zero 设备文件中取出一个大小为 560MB 的数据块，然后保存成名为 560_file 的文件</li>
</ul>
<h3 id="30-file-查看文件类型"><a href="#30-file-查看文件类型" class="headerlink" title="30.file 查看文件类型"></a>30.file 查看文件类型</h3><h3 id="31-tar-对文件进行打包压缩或者解压"><a href="#31-tar-对文件进行打包压缩或者解压" class="headerlink" title="31.tar 对文件进行打包压缩或者解压"></a>31.tar 对文件进行打包压缩或者解压</h3><ul>
<li>-c 创建压缩文件</li>
<li>-x 解开压缩文件</li>
<li>-t 查看压缩文件的内容</li>
<li>-z 用Gzip压缩或者解压</li>
<li>-j 用Bzip2压缩或者解压</li>
<li>-v 显示压缩或者解压的过程</li>
<li>-f 目标文件名</li>
<li>-P 保留原始的权限和属性</li>
<li>-p 使用绝对路径来压缩</li>
<li>-C 指定解压到的目录</li>
</ul>
<h3 id="32-grep命令在文本中执行关键词搜索"><a href="#32-grep命令在文本中执行关键词搜索" class="headerlink" title="32.grep命令在文本中执行关键词搜索"></a>32.grep命令在文本中执行关键词搜索</h3><ul>
<li>-b 将可执行文件当作文本文件来搜索</li>
<li>-c 仅显示找到的行数</li>
<li>-i 忽略大小写</li>
<li>-n 显示行号</li>
<li>-v 反向选择—-仅列出没有关键词的行</li>
</ul>
<h3 id="33-find-按照指定条件来查找文件"><a href="#33-find-按照指定条件来查找文件" class="headerlink" title="33.find 按照指定条件来查找文件"></a>33.find 按照指定条件来查找文件</h3><ul>
<li>-name 匹配名称</li>
<li>-perm 匹配权限(mode为完全匹配，-mode为包含即可)</li>
<li>-user 匹配所有者</li>
<li>-group 匹配所有组</li>
<li>-mtime -n +n 匹配修改内容的时间(-n 指前n天以内，+n值n天以前)</li>
<li>-atime 匹配访问文件的时间(-n 指前n天以内，+n值n天以前)</li>
<li>-ctime 匹配修改文件权限的时间(-n 指前n天以内，+n值n天以前)</li>
<li>-nouser 匹配无所有者的文件</li>
<li>-nogroup 匹配无所有组的文件</li>
<li>-newer f1 !f2 匹配比文件分新但比f2旧的文件</li>
<li>-type b/d/c/p/l/f 匹配文件类型 （块设备、目录、字符设备、管道、链接文件、文本文件）</li>
<li>-size 匹配文件的大小 （+50KB 为查找超过 50KB 的文件，而-50KB 为查找小于50KB 的文件）</li>
<li>-prune 忽略某个目录</li>
<li>-exec … {} ;后面可跟用于进一步处理搜索结果的命令</li>
</ul>
<h2 id="输入输出重定向"><a href="#输入输出重定向" class="headerlink" title="输入输出重定向"></a>输入输出重定向</h2><table>
<thead>
<tr>
<th>符号</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td>命令 &gt; 文件</td>
<td>将标准输出重定向到一个文件中（清空原有文件的数据）</td>
</tr>
<tr>
<td>命令 2&gt; 文件</td>
<td>将错误输出重定向到一个文件中（清空原有文件的数据）</td>
</tr>
<tr>
<td>命令 &gt;&gt; 文件</td>
<td>将标准输出重定向到一个文件中（追加到原有内容的后面）</td>
</tr>
<tr>
<td>命令 2&gt;&gt; 文件</td>
<td>将错误输出重定向到一个文件中（追加到原有内容的后面）</td>
</tr>
<tr>
<td>命令 &gt;&gt; 文件 2&gt;&amp;1 或 命令 &amp;&gt;&gt; 文件</td>
<td>将标准输出与错误输出共同写入到文件中（追加到原有内容的后面）</td>
</tr>
<tr>
<td>命令 &lt; 文件</td>
<td>将文件作为命令的标准输入</td>
</tr>
<tr>
<td>命令 &lt;&lt; 分界符</td>
<td>从标准输入中读入，直到遇见分界符才停止</td>
</tr>
<tr>
<td>命令 &lt; 文件 1 &gt; 文件 2</td>
<td>将文件 1 作为命令的标准输入并将标准输出到文件 2</td>
</tr>
</tbody></table>
<h2 id="管道符号"><a href="#管道符号" class="headerlink" title="管道符号 |"></a>管道符号 |</h2><p>通过把管道符和 passwd 命令的–stdin 参数相结合，我们可以用一条</p>
<p>命令来完成密码重置操作</p>
<pre class=" language-bash"><code class="language-bash"><span class="token keyword">echo</span> <span class="token string">"linuxprobe"</span> <span class="token operator">|</span> <span class="token function">passwd</span> --stdin root</code></pre>
<h2 id="条件测试-1"><a href="#条件测试-1" class="headerlink" title="条件测试 [ $? == 1 ]"></a>条件测试 [ $? == 1 ]</h2><table>
<thead>
<tr>
<th>运算符</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td>-d</td>
<td>测试文件是否为目录类型</td>
</tr>
<tr>
<td>-e</td>
<td>测试文件是否存在</td>
</tr>
<tr>
<td>-f</td>
<td>测试是否是一般文件</td>
</tr>
<tr>
<td>-r</td>
<td>测试当前用户是否有权限读取</td>
</tr>
<tr>
<td>-w</td>
<td>测试当前用户是否有权限写入</td>
</tr>
<tr>
<td>-x</td>
<td>测试当前用户是否有权限执行</td>
</tr>
</tbody></table>
<pre class=" language-bash"><code class="language-bash"><span class="token function">ping</span> -c 3 -i 0.2 -W 3 <span class="token variable">$1</span> <span class="token operator">&amp;</span><span class="token operator">></span> /dev/null</code></pre>
<blockquote>
<p>Linux 系统中的 ping 命令不像 Windows 一样尝试 4 次就结束，因此为</p>
<p>了避免用户等待时间过长，需要通过-c 参数来规定尝试的次数，并使用-i 参数定义每个数据</p>
<p>包的发送间隔，以及使用-W 参数定义等待超时时间。</p>
</blockquote>
<h2 id="循环语句"><a href="#循环语句" class="headerlink" title="循环语句"></a>循环语句</h2><p><strong><code>for in done</code></strong> </p>
<pre class=" language-bash"><code class="language-bash">HLIST<span class="token operator">=</span><span class="token variable"><span class="token variable">$(</span><span class="token function">cat</span> ~/ipadds.txt<span class="token variable">)</span></span> 
<span class="token keyword">for</span> IP <span class="token keyword">in</span> <span class="token variable">$HLIST</span> 
<span class="token keyword">do</span> 
<span class="token function">ping</span> -c 3 -i 0.2 -W 3 <span class="token variable">$IP</span> <span class="token operator">&amp;</span><span class="token operator">></span> /dev/null 
<span class="token keyword">if</span> <span class="token punctuation">[</span> <span class="token variable">$?</span> -eq 0 <span class="token punctuation">]</span> <span class="token punctuation">;</span> <span class="token keyword">then</span> 
<span class="token keyword">echo</span> <span class="token string">"Host <span class="token variable">$IP</span> is On-line."</span> 
<span class="token keyword">else</span> 
<span class="token keyword">echo</span> <span class="token string">"Host <span class="token variable">$IP</span> is Off-line."</span> 
<span class="token keyword">fi</span> 
<span class="token keyword">done</span></code></pre>
<p><strong>while do done</strong></p>
<pre class=" language-bash"><code class="language-bash">PRICE<span class="token operator">=</span><span class="token variable"><span class="token variable">$(</span><span class="token function">expr</span> $RANDOM % 1000<span class="token variable">)</span></span> 
TIMES<span class="token operator">=</span>0 
<span class="token keyword">echo</span> <span class="token string">"商品实际价格为 0-999 之间，猜猜看是多少？"</span> 
<span class="token keyword">while</span> <span class="token boolean">true</span> 
<span class="token keyword">do</span> 
<span class="token function">read</span> -p <span class="token string">"请输入您猜测的价格数目："</span> INT 
<span class="token keyword">let</span> TIMES++ 
<span class="token keyword">if</span> <span class="token punctuation">[</span> <span class="token variable">$INT</span> -eq <span class="token variable">$PRICE</span> <span class="token punctuation">]</span> <span class="token punctuation">;</span> <span class="token keyword">then</span> 
<span class="token keyword">echo</span> <span class="token string">"恭喜您答对了，实际价格是 <span class="token variable">$PRICE</span>"</span> 
<span class="token keyword">echo</span> <span class="token string">"您总共猜测了 <span class="token variable">$TIMES</span> 次"</span> 
<span class="token keyword">exit</span> 0 
<span class="token keyword">elif</span> <span class="token punctuation">[</span> <span class="token variable">$INT</span> -gt <span class="token variable">$PRICE</span> <span class="token punctuation">]</span> <span class="token punctuation">;</span> <span class="token keyword">then</span> 
<span class="token keyword">echo</span> <span class="token string">"太高了！"</span> 
<span class="token keyword">else</span> 
<span class="token keyword">echo</span> <span class="token string">"太低了！"</span> 
<span class="token keyword">fi</span> 
<span class="token keyword">done</span></code></pre>
<blockquote>
<p>注释：</p>
<p>expr 为数学运算，计算数值的时候用expr</p>
<p>let 命令是 BASH 中用于计算的工具，用于执行一个或多个表达式，变量计算中不需要加上 $ 来表示变量。如果表达式中包含了空格或其他特殊字符，则必须引起来。</p>
</blockquote>
<p><strong><code>case</code></strong></p>
<pre class=" language-bash"><code class="language-bash"><span class="token function">read</span> -p <span class="token string">"请输入一个字符，并按 Enter 键确认："</span> KEY 
<span class="token keyword">case</span> <span class="token string">"<span class="token variable">$KEY</span>"</span> <span class="token keyword">in</span> 
<span class="token punctuation">[</span>a-z<span class="token punctuation">]</span><span class="token operator">|</span><span class="token punctuation">[</span>A-Z<span class="token punctuation">]</span><span class="token punctuation">)</span> 
<span class="token keyword">echo</span> <span class="token string">"您输入的是 字母。"</span> 
<span class="token punctuation">;</span><span class="token punctuation">;</span> 
<span class="token punctuation">[</span>0-9<span class="token punctuation">]</span><span class="token punctuation">)</span> 
<span class="token keyword">echo</span> <span class="token string">"您输入的是 数字。"</span> 
<span class="token punctuation">;</span><span class="token punctuation">;</span> 
*<span class="token punctuation">)</span> 
<span class="token keyword">echo</span> <span class="token string">"您输入的是 空格、功能键或其他控制字符。"</span> 
esac</code></pre>
<h2 id="用户身份与权限"><a href="#用户身份与权限" class="headerlink" title="用户身份与权限"></a>用户身份与权限</h2><h3 id="useradd-创建新的用户"><a href="#useradd-创建新的用户" class="headerlink" title="useradd 创建新的用户"></a>useradd 创建新的用户</h3><ul>
<li><p>-d 指定用户的家目录（默认为/home/username）</p>
</li>
<li><p>-e 账户的到期时间，格式为 YYYY-MM-DD. </p>
</li>
<li><p>-u 指定该用户的默认 UID </p>
</li>
<li><p>-g 指定一个初始的用户基本组（必须已存在）</p>
</li>
<li><p>-G 指定一个或多个扩展用户组</p>
</li>
<li><p>-N 不创建与用户同名的基本用户组</p>
</li>
<li><p>-s 指定该用户的默认 Shell 解释器</p>
</li>
</ul>
<pre class=" language-bash"><code class="language-bash"><span class="token function">useradd</span> -d /home/linux -u 8888 -s /sbin/nologin lstink</code></pre>
<blockquote>
<p>请注意/sbin/nologin，它是终端解释器中的一员，与 Bash 解释器有着天壤之别。</p>
<p>一旦用户的解释器被设置为 nologin，则代表该用户不能登录到系统中</p>
</blockquote>
<h3 id="groupadd-创建用户组"><a href="#groupadd-创建用户组" class="headerlink" title="groupadd 创建用户组"></a>groupadd 创建用户组</h3><pre class=" language-bash"><code class="language-bash"><span class="token function">groupadd</span> lstink</code></pre>
<h3 id="usermod-修改用户的属性"><a href="#usermod-修改用户的属性" class="headerlink" title="usermod 修改用户的属性"></a>usermod 修改用户的属性</h3><ul>
<li><p>-c 填写用户账户的备注信息</p>
</li>
<li><p>-d -m 参数-m 与参数-d 连用，可重新指定用户的家目录并自动把旧的数据转移过去</p>
</li>
<li><p>-e 账户的到期时间，格式为 YYYY-MM-DD </p>
</li>
<li><p>-g 变更所属用户组</p>
</li>
<li><p>-G 变更扩展用户组</p>
</li>
<li><p>-L 锁定用户禁止其登录系统</p>
</li>
<li><p>-U 解锁用户，允许其登录系统</p>
</li>
<li><p>-s 变更默认终端</p>
</li>
<li><p>-u 修改用户的 UID </p>
</li>
</ul>
<h3 id="passwd-修改用户密码"><a href="#passwd-修改用户密码" class="headerlink" title="passwd 修改用户密码"></a>passwd 修改用户密码</h3><ul>
<li><p>-l 锁定用户，禁止其登录</p>
</li>
<li><p>-u 解除锁定，允许用户登录</p>
</li>
<li><p>–stdin 允许通过标准输入修改用户密码，如echo “NewPassWord” | passwd –stdin Username </p>
</li>
<li><p>-d 使该用户可用空密码登录系统</p>
</li>
<li><p>-e 强制用户在下次登录时修改密码</p>
</li>
<li><p>-S 显示用户的密码是否被锁定，以及密码所采用的加密算法名称</p>
</li>
</ul>
<h3 id="userdel-删除用户"><a href="#userdel-删除用户" class="headerlink" title="userdel 删除用户"></a>userdel 删除用户</h3><ul>
<li><p>-f 强制删除用户</p>
</li>
<li><p>-r 同时删除用户及用户家目录</p>
</li>
</ul>

            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://blog.zhangshan.xyz" rel="external nofollow noreferrer">lstink</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://blog.zhangshan.xyz/2020/07/18/linux-xue-xi-ji-lu/">https://blog.zhangshan.xyz/2020/07/18/linux-xue-xi-ji-lu/</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="https://blog.zhangshan.xyz" target="_blank">lstink</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/tags/linux/">
                                    <span class="chip bg-color">linux</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/libs/share/css/share.min.css">
<div id="article-share">

    
    <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="/libs/share/js/social-share.min.js"></script>
    

    

</div>

                </div>
            </div>
            
                <style>
    #reward {
        margin: 40px 0;
        text-align: center;
    }

    #reward .reward-link {
        font-size: 1.4rem;
        line-height: 38px;
    }

    #reward .btn-floating:hover {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.2);
    }

    #rewardModal {
        width: 320px;
        height: 350px;
    }

    #rewardModal .reward-title {
        margin: 15px auto;
        padding-bottom: 5px;
    }

    #rewardModal .modal-content {
        padding: 10px;
    }

    #rewardModal .close {
        position: absolute;
        right: 15px;
        top: 15px;
        color: rgba(0, 0, 0, 0.5);
        font-size: 1.3rem;
        line-height: 20px;
        cursor: pointer;
    }

    #rewardModal .close:hover {
        color: #ef5350;
        transform: scale(1.3);
        -moz-transform:scale(1.3);
        -webkit-transform:scale(1.3);
        -o-transform:scale(1.3);
    }

    #rewardModal .reward-tabs {
        margin: 0 auto;
        width: 210px;
    }

    .reward-tabs .tabs {
        height: 38px;
        margin: 10px auto;
        padding-left: 0;
    }

    .reward-content ul {
        padding-left: 0 !important;
    }

    .reward-tabs .tabs .tab {
        height: 38px;
        line-height: 38px;
    }

    .reward-tabs .tab a {
        color: #fff;
        background-color: #ccc;
    }

    .reward-tabs .tab a:hover {
        background-color: #ccc;
        color: #fff;
    }

    .reward-tabs .wechat-tab .active {
        color: #fff !important;
        background-color: #22AB38 !important;
    }

    .reward-tabs .alipay-tab .active {
        color: #fff !important;
        background-color: #019FE8 !important;
    }

    .reward-tabs .reward-img {
        width: 210px;
        height: 210px;
    }
</style>

<div id="reward">
    <a href="#rewardModal" class="reward-link modal-trigger btn-floating btn-medium waves-effect waves-light red">赏</a>

    <!-- Modal Structure -->
    <div id="rewardModal" class="modal">
        <div class="modal-content">
            <a class="close modal-close"><i class="fas fa-times"></i></a>
            <h4 class="reward-title">你的赏识是我前进的动力</h4>
            <div class="reward-content">
                <div class="reward-tabs">
                    <ul class="tabs row">
                        <li class="tab col s6 alipay-tab waves-effect waves-light"><a href="#alipay">支付宝</a></li>
                        <li class="tab col s6 wechat-tab waves-effect waves-light"><a href="#wechat">微 信</a></li>
                    </ul>
                    <div id="alipay">
                        <img src="/medias/reward/alipay.jpg" class="reward-img" alt="支付宝打赏二维码">
                    </div>
                    <div id="wechat">
                        <img src="/medias/reward/wechat.jpg" class="reward-img" alt="微信打赏二维码">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('.tabs').tabs();
    });
</script>

            
        </div>
    </div>

    

    

    

    

    
        <style>
    .valine-card {
        margin: 1.5rem auto;
    }

    .valine-card .card-content {
        padding: 20px 20px 5px 20px;
    }

    #vcomments textarea {
        box-sizing: border-box;
        background: url("/medias/comment_bg.png") 100% 100% no-repeat;
    }

    #vcomments p {
        margin: 2px 2px 10px;
        font-size: 1.05rem;
        line-height: 1.78rem;
    }

    #vcomments blockquote p {
        text-indent: 0.2rem;
    }

    #vcomments a {
        padding: 0 2px;
        color: #4cbf30;
        font-weight: 500;
        text-decoration: none;
    }

    #vcomments img {
        max-width: 100%;
        height: auto;
        cursor: pointer;
    }

    #vcomments ol li {
        list-style-type: decimal;
    }

    #vcomments ol,
    ul {
        display: block;
        padding-left: 2em;
        word-spacing: 0.05rem;
    }

    #vcomments ul li,
    ol li {
        display: list-item;
        line-height: 1.8rem;
        font-size: 1rem;
    }

    #vcomments ul li {
        list-style-type: disc;
    }

    #vcomments ul ul li {
        list-style-type: circle;
    }

    #vcomments table, th, td {
        padding: 12px 13px;
        border: 1px solid #dfe2e5;
    }

    #vcomments table, th, td {
        border: 0;
    }

    table tr:nth-child(2n), thead {
        background-color: #fafafa;
    }

    #vcomments table th {
        background-color: #f2f2f2;
        min-width: 80px;
    }

    #vcomments table td {
        min-width: 80px;
    }

    #vcomments h1 {
        font-size: 1.85rem;
        font-weight: bold;
        line-height: 2.2rem;
    }

    #vcomments h2 {
        font-size: 1.65rem;
        font-weight: bold;
        line-height: 1.9rem;
    }

    #vcomments h3 {
        font-size: 1.45rem;
        font-weight: bold;
        line-height: 1.7rem;
    }

    #vcomments h4 {
        font-size: 1.25rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    #vcomments h5 {
        font-size: 1.1rem;
        font-weight: bold;
        line-height: 1.4rem;
    }

    #vcomments h6 {
        font-size: 1rem;
        line-height: 1.3rem;
    }

    #vcomments p {
        font-size: 1rem;
        line-height: 1.5rem;
    }

    #vcomments hr {
        margin: 12px 0;
        border: 0;
        border-top: 1px solid #ccc;
    }

    #vcomments blockquote {
        margin: 15px 0;
        border-left: 5px solid #42b983;
        padding: 1rem 0.8rem 0.3rem 0.8rem;
        color: #666;
        background-color: rgba(66, 185, 131, .1);
    }

    #vcomments pre {
        font-family: monospace, monospace;
        padding: 1.2em;
        margin: .5em 0;
        background: #272822;
        overflow: auto;
        border-radius: 0.3em;
        tab-size: 4;
    }

    #vcomments code {
        font-family: monospace, monospace;
        padding: 1px 3px;
        font-size: 0.92rem;
        color: #e96900;
        background-color: #f8f8f8;
        border-radius: 2px;
    }

    #vcomments pre code {
        font-family: monospace, monospace;
        padding: 0;
        color: #e8eaf6;
        background-color: #272822;
    }

    #vcomments pre[class*="language-"] {
        padding: 1.2em;
        margin: .5em 0;
    }

    #vcomments code[class*="language-"],
    pre[class*="language-"] {
        color: #e8eaf6;
    }

    #vcomments [type="checkbox"]:not(:checked), [type="checkbox"]:checked {
        position: inherit;
        margin-left: -1.3rem;
        margin-right: 0.4rem;
        margin-top: -1px;
        vertical-align: middle;
        left: unset;
        visibility: visible;
    }

    #vcomments b,
    strong {
        font-weight: bold;
    }

    #vcomments dfn {
        font-style: italic;
    }

    #vcomments small {
        font-size: 85%;
    }

    #vcomments cite {
        font-style: normal;
    }

    #vcomments mark {
        background-color: #fcf8e3;
        padding: .2em;
    }

    #vcomments table, th, td {
        padding: 12px 13px;
        border: 1px solid #dfe2e5;
    }

    table tr:nth-child(2n), thead {
        background-color: #fafafa;
    }

    #vcomments table th {
        background-color: #f2f2f2;
        min-width: 80px;
    }

    #vcomments table td {
        min-width: 80px;
    }

    #vcomments [type="checkbox"]:not(:checked), [type="checkbox"]:checked {
        position: inherit;
        margin-left: -1.3rem;
        margin-right: 0.4rem;
        margin-top: -1px;
        vertical-align: middle;
        left: unset;
        visibility: visible;
    }
</style>

<div class="card valine-card" data-aos="fade-up">
    <div class="comment_headling" style="font-size: 20px; font-weight: 700; position: relative; padding-left: 20px; top: 15px; padding-bottom: 5px;">
        <i class="fas fa-comments fa-fw" aria-hidden="true"></i>
        <span>评论</span>
    </div>
    <div id="vcomments" class="card-content" style="display: grid">
    </div>
</div>

<script src="/libs/valine/av-min.js"></script>
<script src="/libs/valine/Valine.min.js"></script>
<script>
    new Valine({
        el: '#vcomments',
        appId: '045fI4gG4wex9OTYw703D5Fp-gzGzoHsz',
        appKey: 'MsR9j3W6Euk4tUEl7Y9NTBwE',
        notify: 'false' === 'true',
        verify: 'false' === 'true',
        visitor: 'true' === 'true',
        avatar: 'mm',
        pageSize: '10',
        lang: 'zh-cn',
        placeholder: 'just go go'
    });
</script>

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;上一篇</div>
            <div class="card">
                <a href="/2020/08/09/hei-ping-guo-ming-ling-xing-zhi-zuo-yuan-ban-jing-xiang/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/11.jpg" class="responsive-img" alt="黑苹果命令行制作原版镜像">
                        
                        <span class="card-title">黑苹果命令行制作原版镜像</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            黑苹果制作原版镜像的方式准备工具
16G U盘一个（用来制作安装盘）
mac系统(下载原版镜像)

制作步骤
通过appstore下载想要安装的原版镜像
插上U盘，格式化为扩展日志式,选择guid分区表，并重命名为USB
打开终端，输入对应
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2020-08-09
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/%E9%BB%91%E8%8B%B9%E6%9E%9C/" class="post-category">
                                    黑苹果
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/%E9%BB%91%E8%8B%B9%E6%9E%9C/">
                        <span class="chip bg-color">黑苹果</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                下一篇&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/2020/07/09/windows-xia-pei-zhi-huan-jing-bian-liang-de-yi-yi-he-fang-fa/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/10.jpg" class="responsive-img" alt="windows下配置环境变量的意义和方法">
                        
                        <span class="card-title">windows下配置环境变量的意义和方法</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            windows 10 配置环境变量的方法1. 首先我们来说一下环境变量是什么?  每一次系统的启动，都会读取各个启动文件中配置的变量，通过这些变量它才能准确的找到每一个应用程序和命令所对应的存储位置，找到存储位置之后，它就可以启动程序了。

                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2020-07-09
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/windows/" class="post-category">
                                    windows
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/windows/">
                        <span class="chip bg-color">windows</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>



<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/libs/codeBlock/codeBlockFuction.js"></script>

<!-- 代码语言 -->

<script type="text/javascript" src="/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/libs/codeBlock/codeShrink.js"></script>


<!-- 代码块折行 -->

<style type="text/css">
code[class*="language-"], pre[class*="language-"] { white-space: pre !important; }
</style>


    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('0'),
            headingSelector: 'h2, h3, h4'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h2, h3, h4').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>




    <footer class="page-footer bg-color">
    
    <div class="container row center-align" style="margin-bottom: 0px !important;">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            <span id="year">2020</span>
            <a href="https://blog.zhangshan.xyz" target="_blank">Lstink</a>
            |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a>
            |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a>
            <br>
            
            &nbsp;<i class="fas fa-chart-area"></i>&nbsp;站点总字数:&nbsp;<span
                class="white-color">15.8k</span>&nbsp;字
            
            
            
            
            
            
            <span id="busuanzi_container_site_pv">
                |&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;<span id="busuanzi_value_site_pv"
                    class="white-color"></span>&nbsp;次
            </span>
            
            
            <span id="busuanzi_container_site_uv">
                |&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;<span id="busuanzi_value_site_uv"
                    class="white-color"></span>&nbsp;人
            </span>
            
            <br>
            
            <br>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">
    <a href="https://github.com/Lstink" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
        <i class="fab fa-github"></i>
    </a>



    <a href="mailto:1318385889@qq.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>







    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=1318385889" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 1318385889" data-position="top" data-delay="50">
        <i class="fab fa-qq"></i>
    </a>







    <a href="/atom.xml" class="tooltipped" target="_blank" data-tooltip="RSS 订阅" data-position="top" data-delay="50">
        <i class="fas fa-rss"></i>
    </a>

</div>
    </div>
</footer>

<div class="progress-bar"></div>


    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script src="/js/search.js"></script>
<script type="text/javascript">
$(function () {
    searchFunc("/search.xml", 'searchInput', 'searchResult');
});
</script>

    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="/libs/materialize/materialize.min.js"></script>
    <script src="/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="/libs/aos/aos.js"></script>
    <script src="/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/js/matery.js"></script>

    <!-- Baidu Analytics -->

<script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?46c241b68612fa4342cdc95d5448203b";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <script src="/libs/others/clicklove.js" async="async"></script>
    
    
    <script async src="/libs/others/busuanzi.pure.mini.js"></script>
    

    

    
    <script>
        (function (i, s, o, g, r, a, m) {
            i["DaoVoiceObject"] = r;
            i[r] = i[r] || function () {
                (i[r].q = i[r].q || []).push(arguments)
            }, i[r].l = 1 * new Date();
            a = s.createElement(o), m = s.getElementsByTagName(o)[0];
            a.async = 1;
            a.src = g;
            a.charset = "utf-8";
            m.parentNode.insertBefore(a, m)
        })(window, document, "script", ('https:' == document.location.protocol ? 'https:' : 'http:') +
            "//widget.daovoice.io/widget/6984b559.js", "daovoice")
        daovoice('init', {
            app_id: "2b3c85e9"
        });
        daovoice('update');
    </script>
    

    
    <script type="text/javascript" color="0,0,255"
        pointColor="0,0,255" opacity='0.7'
        zIndex="-1" count="99"
        src="/libs/background/canvas-nest.js"></script>
    

    

    
    <script type="text/javascript" src="/libs/background/ribbon-dynamic.js" async="async"></script>
    

    
    <script src="/libs/instantpage/instantpage.js" type="module"></script>
    

</body>

</html>
